<?php
/**
*
* Layout for the add to cart popup
*
* @package	VirtueMart
* @subpackage Cart
* @author Max Milbers
*
* @link http://www.virtuemart.net
* @copyright Copyright (c) 2013 VirtueMart Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* @version $Id: cart.php 2551 2010-09-30 18:52:40Z milbo $
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
require_once(JPATH_BASE.DS.'components'.DS.'com_brinkmanvm'.DS.'helpers'.DS.'brinkmanvm.php');

$product_model = VmModel::getModel('product');
?>
<?
echo '<a class="showcart gotocatalogue" href="' . $this->continue_link . '">' . JText::_('COM_VIRTUEMART_CART_SHOWCONTINUE') . '</a>';
echo '<a class="showcart" href="' . $this->cart_link . '">' . JText::_('COM_VIRTUEMART_CART_SHOW') . '</a>';
?>


<h4 class="addedProdCart"><strong><?php echo JText::_('COM_VIRTUEMART_ADDEDPROD'); ?></strong></h4>
<?php if($this->product){
	echo '<h4>'.JText::sprintf('COM_VIRTUEMART_CART_PRODUCT_ADDED',$this->product->product_name,$this->product->quantity).'</h4>';
}

if ($this->errorMsg) echo '<div>'.$this->errorMsg.'</div>';

if(VmConfig::get('popup_rel',1)){
	if($this->product and !empty($this->product->customfieldsRelatedProducts)){
		?>
		<div class="product-related-products paddedcart">
				<h4><strong><?php echo JText::_('COM_VIRTUEMART_RELATED_PRODUCTS'); ?></strong></h4>
		<?php
		foreach ($this->product->customfieldsRelatedProducts as $field) {
			if(!empty($field->display)) {
				?>
							    <?php  $product = $product_model->getProduct($field->custom_value,TRUE,TRUE,TRUE,$quantity);?>

				<div class="imageProdRel">
		    		<?php $image = BrinkmanvmHelper::showImage($field->custom_value,'img img-rounded related-imagePadded',true);?>
		    		<?php echo JHTML::link ($product->link, $image); ?>
		    	</div>
		    	<div class="textProdRel">
			    	<?php echo JHTML::link ($product->link, $product->product_name); ?>
		    	</div>
				
			<?php }
		} ?>
		</div>
	<?php
	}
}

?><br style="clear:both">
